package cn.edu.usst.cs.goldfish.booking.meetingroom;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.bind.annotation.CrossOrigin;

import java.io.*;
import java.util.Scanner;

@SpringBootApplication(
        scanBasePackages = {
                "cn.edu.usst.cs.goldfish.booking.meetingroom",
                "cn.edu.usst.cs.goldfish.booking.meetingroom.mapstruct",
        }
)
@EnableAspectJAutoProxy
@MapperScan("cn.edu.usst.cs.goldfish.booking.meetingroom.mybatis")
@CrossOrigin(origins = {
        "http://localhost:5173",
        "http://192.168.1.*:5173",
        "*"
}, allowCredentials = "true")
public class SysApplication {

    public static void main(String[] args) {
        SpringApplication.run(SysApplication.class, args);
        final String success_text_file = "success.txt";
        try (
                InputStream stream = SysApplication.class
                        .getClassLoader()
                        .getResourceAsStream(success_text_file);
                Reader reader = new InputStreamReader(stream);
                BufferedReader bufferedReader = new BufferedReader(reader);
                // Scanner scanner = new Scanner(System.in);
        ) {
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                System.out.println(line);
            }
            // scanner.next();
            // System.exit(0);
            


        } catch (IOException | NullPointerException e) {
            System.out.println("!! 好像找不到" + success_text_file);
            System.out.println(" 不过没关系 应用启动成功了 ");
        }

    }

}
